package edu.zju.gis.dbfg.model.statistic;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

@Getter
@Setter
public class PacStatisticArgs implements Serializable {
    private final static Logger logger = LoggerFactory.getLogger(PacStatisticArgs.class);

    @Option(name = "-output",usage = "输出文件路径", required = true)
    private String output;

//    @Option(name = "-scale",usage = "统计级别", required = true)
//    private String scale;//GUO/SHENG/XIAN

    @Option(name = "-input",usage = "输入数据,data", required = true)
    private String input;

    @Option(name = "-type",usage = "输入数据类型", required = true)
    private String type;

    @Option(name = "-ccIndex",usage = "CC码字段", required = true)
    private String ccIndex;

    @Option(name = "-pacIndex",usage = "pac字段", required = true)
    private String pacIndex;

    @Option(name = "-areaIndex",usage = "面积字段", required = true)
    private String areaIndex;

    @Option(name = "-filterIndex", usage = "过滤字段", required =  true)
    private String filterIndex;

    @Option(name = "-filters",usage = "统计条件", required = true)
    private String filters;

//    @Option(name = "-yearIndex",usage = "输入数据类型,data", required = true)
//    private String yearIndex;

    @Option(name = "-crs1",usage = "extent crs")
    private String crs1 = "4326";


    @Option(name = "-parallelize", usage="parallelize num")
    private int partitionNum = 4;

    public  static  PacStatisticArgs initArgs(String args[]){
        PacStatisticArgs mArgs = new PacStatisticArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }
}
